const Service = require('egg').Service;
class HxsService extends Service {
    async zhonglei(class0) {
        const sql = `SELECT * FROM caipu where classer = "${class0}"`
        const data = await this.app.mysql.query(sql);
        return data;
    };
    async caidan(class1,class2) {
        const sql = `SELECT * FROM cook right join  cook1user on cook.id =cook1user.cookid inner join user on userid=user.id where class="${class1}" or class="${class2}" limit 1,13`
        const data = await this.app.mysql.query(sql);
        return data;
    };
    async caidan2(class1,class2) {
        const sql = `SELECT * FROM cook right join  cook1user on cook.id =cook1user.cookid inner join user on userid=user.id where class="${class1}" or class="${class2}" limit 14,13`
        const data = await this.app.mysql.query(sql);
        return data;
    };
    async tuijianshangpin(class1,class2,class3) {
        const sql = `SELECT * FROM cook where class = "${class1}"or class = "${class2}" or class = "${class3}" limit 1,8 `
        const data = await this.app.mysql.query(sql);
        return data;
    };
    async addshuju(newpath1img,title,miaoshu,tip,yongliao,buzhou,pushtime,classend,strpastimg) {
        const sql = `INSERT  INTO cook (img,title,miaoshu,tip,yongliao,buzhou,pushtime,class,buzouimg) VALUES("${newpath1img}","${title}","${miaoshu}","${tip}","${yongliao}","${buzhou}","${pushtime}","${classend}","${strpastimg}") `
        const data = await this.app.mysql.query(sql);
        return data;
    };

}

module.exports = HxsService;